unit Map_K4;

interface

uses
  SysUtils, Classes, ADODB, DataEngine, Class_K4;

type
  TMap_K4 = class(TDataEngine)
  public
    function ReadDS(AADODst: TADODataSet): TBaseClass; override;
    function GetStrsIndex(ABaseClass: TBaseClass): string; override;

    function GetStrInsert: string; override;
    function GetStrUpdate: string; override;
    function GetStrDelete: string; override;
    procedure SetParameters(ABaseClass: TBaseClass); override;

    function GetK4(CodeA: string; K4StrsListA: TStringList): TK4;
  end;

implementation

{ TMap_K4 }

function TMap_K4.GetK4(CodeA: string; K4StrsListA: TStringList): TK4;
var
  I: Integer;
begin
  Result := nil;
  if CodeA = '' then Exit;
  for I := 0 to K4StrsListA.Count - 1 do
  begin
    if TK4(K4StrsListA.Objects[I]).KHBH = CodeA then
    begin
      Result := TK4(K4StrsListA.Objects[I]);
      Exit;
    end;
  end;
end;

function TMap_K4.GetStrDelete: string;
begin
  Result := '';
end;

function TMap_K4.GetStrInsert: string;
begin
  Result := '';
end;

function TMap_K4.GetStrsIndex(ABaseClass: TBaseClass): string;
begin
  Result := '';
end;

function TMap_K4.GetStrUpdate: string;
begin
  Result := '';
end;

function TMap_K4.ReadDS(AADODst: TADODataSet): TBaseClass;
begin
  Result := TK4.Create;
  with TK4(Result) do
  begin
    KHBH := AADODst.FieldByName('KHBH').AsString;
    KHNAME := AADODst.FieldByName('KHNAME').AsString;
    JC := AADODst.FieldByName('JC').AsString;
    KHGROUP := AADODst.FieldByName('KHGROUP').AsString;
  end;
end;

procedure TMap_K4.SetParameters(ABaseClass: TBaseClass);
begin
  inherited;

end;

end.
